#include <bits/stdc++.h>
using namespace std;
string toBinary(long long int n){
    string s;
    while (n != 0){
        s += (n % 2?"0":"1");
        n/=2;
    }
    return s;
}
long long int toDecimal(string n){
    long long int k=1;
    long long int res=0;
    for (int i=n.length()-1;i>=0;i--){
        if (n[i]=='1') res+=k;
        k*=2;
    }
    return res;
}
int main(){
    int n,m;
    long long int dec;
    cin>>n>>m;
    string bin,op;
    cin>>bin>>op;
    dec = toDecimal(bin);
    for (char ch : op){
        switch (ch){
            case '+':
                dec+=1;break;
            case '-':
                dec-=1;break;
            case '*':
                dec*=2;break;
            case '/':
                dec/=2;break;
        }
    }
    cout<<toBinary(dec);
    return 0;
}